#ifndef _S_LIST_H
#define _S_LIST_H

#define ElementType int

typedef struct S_ListNode
{
    ElementType data;
    struct S_ListNode *next;
} S_ListNode;

typedef struct S_List
{
    int len;
    S_ListNode *head;
} S_List;

extern inline int IsEmpty(S_List *list);

extern S_List *InitList();

extern void Insert_Front(S_List* list, ElementType data);

extern void Insert_Back(S_List *list, ElementType data);

extern void Insert_Before(S_List *list, ElementType findData, ElementType data);

extern void Insert_After(S_List *list, ElementType findData, ElementType data);

extern void Remove_Front(S_List *list);

extern void Remove_Back(S_List *list);

extern void Remove(S_List *list, ElementType findData);

extern S_ListNode *GetNodeByElement(S_List *list, ElementType findData);

extern S_ListNode *GetNodeByIndex(S_List *list, int index);

extern int SetDataByIndex(S_List *list, int index, ElementType newData);

extern int SetDataByElement(S_List *list, ElementType findData, ElementType newData);

#endif

